/**
 * 去掉 HTML 标签
 * @param {string} html
 * @returns {string}
 */
export const stripHtml = (html) => {
    if (!html) return ''
    return html.replace(/<[^>]+>/g, '').trim()
}

/**
 * 截取文本
 * @param {string} text
 * @param {number} length
 * @returns {string}
 */
export const truncateText = (text, length) => {
    if (!text) return ''
    return text.length > length ? text.slice(0, length) + '...' : text
}
